#include <iostream>
#define MAXN 100000
using namespace std;

int N, array[MAXN], dp[MAXN];
void solve();

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) cin >> array[i];
    solve();
    return 0;
}

void solve() {
    int res = 0;
    dp[0] = 1;
    for (int i = 1; i < N; i++) {
        dp[i] = 1;
        if (array[i] == array[i - 1] + 1) {
            dp[i] = max(dp[i - 1] + 1, dp[i]);
        }
        res = max(dp[i], res);
    }
    cout << res << endl;
}